home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_ddd.idb / usr / freeware / share / ddd-3.3.1 / vsllib / ctree.vsl.z / ctree.vsl
Text File  |  2001-10-09  |  3KB  |  86 lines

  1. // $Id: ctree.vsl,v 1.2 2000/06/09 13:06:26 andreas Exp $ 
  2. // Drawing compact trees
  3.  
  4. // Copyright (C) 1993 Technische Universitaet Braunschweig, Germany.
  5. // Written by Andreas Zeller <zeller@gnu.org>.
  6. // 
  7. // This file is part of DDD.
  8. // 
  9. // DDD is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2 of the License, or (at your option) any later version.
  13. // 
  14. // DDD is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. // See the GNU General Public License for more details.
  18. // 
  19. // You should have received a copy of the GNU General Public
  20. // License along with DDD -- see the file COPYING.
  21. // If not, write to the Free Software Foundation, Inc.,
  22. // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. // 
  24. // DDD is the data display debugger.
  25. // For details, see the DDD World-Wide-Web page, 
  26. // `http://www.gnu.org/software/ddd/',
  27. // or send a mail to the DDD developers <ddd@gnu.org>.
  28.  
  29. #include "tree.vsl"
  30.  
  31. // Version
  32. ctree_version() = "$Revision: 1.2 $";
  33.  
  34. // Horizontal tree
  35.  
  36. hreplaceEven([], _) = [];
  37. hreplaceEven([arg], _) = [arg];
  38. hreplaceEven([arg1, arg2], join) = 
  39.     [arg1, join ^ safe]
  40.     where safe = vspace(arg2 - arg1);
  41. hreplaceEven([arg1, arg2, arg3, argtail...], join) = 
  42.     [arg1, join ^ safe, hreplaceEven([arg3 : argtail], join)...]
  43.     where safe = vspace(arg2 - arg1) ^ vspace(arg2 - arg3);
  44.  
  45. _hattachEven(_, [], []) = 0;
  46. _hattachEven(_, [_], [_]) = 0;
  47.  
  48. _hattachEven(sum, [_, son2, sontail...], [new1, new2, newtail...]) =
  49.   (vspace((sum | new1 | (new2 / 2)) - son2 / 2) | (vcenter(new2 ^ 2) & son2)) ^ 
  50.   _hattachEven(sum | new1 | new2, sontail, newtail);
  51.  
  52. hattachEven(sons, newsons) = _hattachEven(0, sons, newsons);
  53.  
  54. hctree(root, sons...) = 
  55.     (let newsons = hreplaceEven(sons, join) in
  56.         vfix(htree(root, newsons...)) 
  57.       & hattachEven(sons, newsons))
  58.     where join = vcenter(hwhite() | hrule() | hwhite());
  59.  
  60.  
  61. // Vertical tree
  62.  
  63. vreplaceEven([], _) = [];
  64. vreplaceEven([arg], _) = [arg];
  65. vreplaceEven([arg1, arg2], join) = 
  66.     [arg1, join ^ safe]
  67.     where safe = hspace(arg2 - arg1);
  68. vreplaceEven([arg1, arg2, arg3, argtail...], join) = 
  69.     [arg1, join ^ safe, vreplaceEven([arg3 : argtail], join)...]
  70.     where safe = hspace(arg2 - arg1) ^ hspace(arg2 - arg3);
  71.  
  72. _vattachEven(_, [], []) = 0;
  73. _vattachEven(_, [_], [_]) = 0;
  74.  
  75. _vattachEven(sum, [_, son2, sontail...], [new1, new2, newtail...]) =
  76.   (hspace((sum & new1 & (new2 / 2)) - son2 / 2) & (hcenter(new2 ^ 2) | son2)) ^ 
  77.   _vattachEven(sum & new1 & new2, sontail, newtail);
  78.  
  79. vattachEven(sons, newsons) = _vattachEven(0, sons, newsons);
  80.  
  81. vctree(root, sons...) = 
  82.     (let newsons = vreplaceEven(sons, join) in
  83.         hfix(vtree(root, newsons...)) 
  84.       | vattachEven(sons, newsons))
  85.     where join = hcenter(vwhite() & vrule() & vwhite());
  86.